<template>
    <div class="detail-rate-info">
      <!-- 标题 -->
      <div class="rate-title">
        <span>用户评价</span>
        <span>更多</span>
      </div>

      <!-- 有评论 -->
      <div class="rate-body" v-if="Object.keys(userRateInfo).length">
        <!-- img & name -->
        <div class="avatar-name">
          <img :src="userRateInfo.userAvatar" alt="">
          <span>{{userRateInfo.userName}}</span>
        </div>
        <!-- rate -->
        <div class="review">
          <p>{{userRateInfo.userRate}}</p>
        </div>
        <!-- created -->
        <div class="created">
          <span>{{userRateInfo.created | dateFormat('YYYY-MM-DD')}}</span>
          <span>{{userRateInfo.style}}</span>
        </div>
      </div>

      <!-- 无评论 -->
      <div class="no-review" v-else>
        <h3>暂无用户评价!</h3>
      </div>
    </div>
</template>

<script>
export default {
  name: 'DetailRateInfo',
  props: {
    userRateInfo: {
      type: Object,
      default () {
        return {}
      }
    }
  },
  data () {
    return {

    }
  },
  methods: {

  },
  watch: {

  },
  components: {

  }
}
</script>

<style lang="less" scoped>
.detail-rate-info {
  padding: 15px 10px 0;
  border-bottom: 5px solid  #f2f5f8;
  font-size: 14px;

  .rate-title {
    display: flex;
    justify-content: space-between;
    padding: 0 0 15px;
    border-bottom: 1px solid #dbdbdb;
  }

  // 有评论
  .rate-body {

    .avatar-name {
      color: #000;
      font-weight: bold;
      margin-top: 10px;

      img {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        vertical-align: middle;
        margin-right: 10px;
      }
    }

    .review {
      margin: 15px 0;
    }

    .created {
      color: #bcbcbc;
      margin: 0 0 20px;

      span:first-child {
        margin-right: 5px;
      }
    }

  }

  // 没有评论
  .no-review {
    height: 50px;
    line-height: 50px;
    text-align: center;

    h3 {
      font-weight: normal;
    }
  }
}

</style>
